package day240508.p4;

public class LinearSecarchTest extends Algorithm {
    public void algorithm(){

        int[] arr=new int[]{10,50,30,70,80,60,20,90,40};
        int target=20;
        boolean notFound=true;
        for (int i = 0; i < arr.length-1 ; i++) {
            if (target==arr[i]){
                System.out.println("在index的位置"+i+"找到了"+target);
                notFound=false;
                break;

            }
        }
        if (notFound){
            System.out.println("没有找到"+target);
        }
    }
}
